import React, { Component } from 'react';

class My extends Component {
    a: HTMLDivElement | null | undefined;
    render() {
        return (
            <div>
                <div ref={ref => this.a=ref}>box</div>
            </div>
        );
    }

    componentDidMount(){
        console.log(this.a)
    }
}

export default My; 